﻿@model List<Kunlun.Models.Works>
@using Kunlun.BusinessLogic;
@{
	ViewBag.Title = "自定义框画";
}
@section Head{
	<link href="@Url.Content("~/Content/member/style.css")" rel="stylesheet" type="text/css" />
	<link href="@Url.Content("~/Content/Base/basic.css")" rel="stylesheet" type="text/css" />
	<script src="@Url.Content("~/Content/base/jquery.simplemodal.js")" type="text/javascript"></script>
	<link href="@Url.Content("~/Content/base/ymPrompt.css")" type="text/css" rel="Stylesheet" />
	<script src="@Url.Content("~/Content/base/Prompt.js")" type="text/javascript"></script>
	<script type="text/javascript">
		function BeginDir() {
			if ($("#FWeight").val() > 60 || $("#FHeight").val() > 60) {
				Alert("自定义相框最大尺寸为60*60cm");
				return;
			}
			if ($("#FWeight").val() < 10 || $("#FHeight").val() < 10) {
				Alert("自定义相框最小尺寸为10*10cm");
				return;
			}
			if (isNaN($("#FWeight").val()) || isNaN($("#FHeight").val())) {
				return;
			}
			location.href = "/PersonFrame/DirFrame?w=" + $("#FWeight").val() + "&h=" + $("#FHeight").val();
		}

		function AddCar(wid) {
			$.post("/PersonFrame/AddCart", { "workID": wid },
			function (data) {
				if (data) {
					Alert("已经放入购物车！");
				} else {
					Alert("网络错误！");
				}
			});
		}

		function DeleteWork(wid) {
			ConfirmInfo("确定删除该自定义框画？", 0, 0, "", function () {
				$.post("/PersonFrame/DeleteWork", { "workID": wid },
				function (data) {
					if (data) {
						$("#row-" + wid).remove();
					}
				});
			});
		}
	</script>
}
<div id="content">
	@Html.Partial("_MymenuPartial")
	<fieldset class="right">
		<legend>操作流程</legend>
		<ol>
			<li><span>输入长和宽</span><a href="javascript:var i=0" onclick="$('#basic-modal-content').modal()">开始DIV</a></li>
			<li><span>选择配件</span></li>
			<li><span>DIV完成</span></li>
		</ol>
	</fieldset>
	<fieldset class="right">
		<legend>历史DIR</legend>
		@foreach (var item in Model) {
			<ul class="mrxc" id="row-@item.ID">
				<li class="photo"><a href="#" class="ImageLink">
					@KunlunHtml.Image(item.Thumbnail, WebLog.PhotoView, "")
				</a></li>
				<li class="pInfo">
					@item.WorksName</li><li class="pInfo">
					<a href="javascript:var i =0;" onclick="AddCar(@item.ID)">放入购物车</a>
					<a href="javascript:var i=0;" onclick="DeleteWork(@item.ID)" class="RemoveLink">删除</a> </li>
			</ul>
  }
	</fieldset>
</div>
<div id="basic-modal-content">
	<dl>
		<dt>输入画框尺寸(单位：厘米,框长不包含在内)</dt>
		<dd>
			宽：<input type="text" id="FWeight" class="input2" />
			CM</dd>
		<dd>
			高：<input type="text" id="FHeight" class="input2" />
			CM</dd>
		<dd>
			<dd>
				<a href="javascript:var i=0;" onclick="BeginDir()">下一步</a></dd>
		</dd>
	</dl>
</div>
